import React, { Component } from "react";
import TodoItem from "./TodoItem";
export default class TodoList extends Component {
  render() {
    return (
      <div>
        {this.props.todos.length > 0 ? (
          <div>
            {this.props.todos.map((item) => {
              return (
                <TodoItem
                  key={item.id}
                  {...item}
                  change={this.props.change}
                  click={this.props.click}
                ></TodoItem>
              );
            })}
          </div>
        ) : (
          <div>暂无数据</div>
        )}
      </div>
    );
  }
}
